<?php

namespace plugin\admin\app\controller\admin;

use plugin\admin\app\common\Auth;
use plugin\admin\app\common\Util;
use plugin\admin\app\controller\AuthController;
use plugin\admin\app\logic\admin\AdminLogic;
use plugin\admin\app\model\Admin;
use support\exception\BusinessException;
use support\Request;
use support\Response;
use Throwable;
use Webman\Captcha\CaptchaBuilder;
use Webman\Captcha\PhraseBuilder;

/**
 * 管理员账户
 */
class AccountController extends AuthController
{

    /**
     * 账户设置
     * @return Response
     * @throws Throwable
     */
    public function index()
    {
        return raw_view('account/index');
    }

    /**
     * 更新
     * @param Request $request
     * @return Response
     * @throws BusinessException
     */
    public function update(Request $request): Response
    {
        return AdminLogic::getInstance()->update($request);
    }

    /**
     *  修改密码
     * @param Request $request
     * @return Response
     * @throws \plugin\admin\app\exception\AdminException
     */
    public function password(Request $request): Response
    {
        return AdminLogic::getInstance()->password($request);
    }

}
